<!DOCTYPE html>
<html>
<head>
    <title>会员中心</title>
    <% include common/meta.ejs %>
    <% include common/public.ejs %>
    <link href="<%= global.config.path.publicPath %>/custom/officialAccount/css/officalCommon.css?v=3" rel="stylesheet">
    <link href="<%= global.config.path.publicPath %><%= body.stylePath %>?v=3" rel="stylesheet">
    <style>
        body {
            background-color: white;
        }

        .weui-loadmore__tips {
            font-size: 16px;
        }

        .tableBody {
            /*height: calc(100% - 250px);*/
            /*height: calc(100% - 200px);*/
            /*height: calc(100% - 200px);*/
            height: auto;
        }

        a:link {
            color: #0b1821;
        }

        a:visited {
            color: #0b1821;
        }

        .underline {
            z-index: 0;
        }

        .box-title {
            z-index: 999;
        }

        .tbList img {
            display: inline-block;
            position: relative;
            left: -5%;
            height: auto;
            width: 30px;
        }

        .tbList {
            height: 50px;
            border-bottom: solid 1px #909090;
            line-height: 50px;
            background-color: #fff;
        }

        .copyright {
            font-size: 14px;
            color: #909090;
            width: 100%;
            text-align: center;
            padding-bottom: 50px;
        }

        #getCard {
            float: left;
        }

        #barCode {
            margin: 0 auto;
            display: block;
            height: 80px;
        }

        #qrcode {
            margin: auto;
            border: solid 1px white;
            width: 140px;
        }
    </style>
</head>
<body ontouchstart>

<div class="weui-row box-title">
    <% if(body.linkFlag == '1'){ %>
        <a class="weui-col-20 header_block header_left" style="background-size: 66%;"
           href="<%= body.linkPath %>/cart?openId=<%= userData.openid %>&orgCode=<%= body.orgCode %>">
        </a>
        <a class="weui-col-60 header_block header_center" href="javascript:void(0);"></a>
        <a class="weui-col-20 header_block header_right" style="background-size: 60%;" href="javascript:void(0);"></a>
    <% }else{ %>
        <a href="javascript:void(0)" onclick="alert('未开通此功能')" class="weui-col-20 header_block header_left"
           style="background-size: 66%;"">
        </a>
        <a class="weui-col-60 header_block header_center" onclick="alert('未开通此功能')"></a>
        <a class="weui-col-20 header_block header_right" style="background-size: 60%;" href="javascript:void(0);"></a>
    <% } %>
</div>

<div class="page-content" style="padding-top:60px">
    <div class="weui-flex">
        <div class="weui-flex__item textCenter">
            <img style="border-radius: 50px" id="userImg" alt="" width="80px">
        </div>
        <div style="width: 70%;position: relative">
            <p><span id="local_vipName"><%= userData.vipName %></span></p>
            <p class="userphone">会员手机：<span id="local_mobile"><%= userData.mobile %></span></p>
            <p class="userphone">会员卡号：<span id="local_cardCode"><%= userData.cardCode %></span></p>
            <p class="userphone">会员等级：<span id="local_rankName"><%= userData.rankName %></span></p>
            <div>
                <div class="btn" id="getCard">会员号</div>
                <!--   <div class="eCardButton">
                    <a href="<%= global.config.path.contextPath %>/view/myEcard?cardCode=<%= userData.cardCode %>&brand=<%= body.brand %>">我的E卡</a>
                </div>-->
            </div>

        </div>
    </div>
    <div class="underline" style="left: 10px;top: 15px"></div>
</div>
<div class="weui-flex">
    <div class="weui-flex__item textCenter tb centerContent">
        <a data-u="pointSearch" class="btnArea" href="javascript:void(0);">
            <span style="font-size: 14px">积分 (<span id="local_currPoint"><%= userData.currPoint %></span>)</span>
        </a>
    </div>
    <div class="weui-flex__item textCenter tb centerContent">
        <a data-u="storeSearch" class="btnArea" href="javascript:void(0);">
            <!--储值 （<%= userData.currAmt %>）-->
            <span style="font-size: 14px">储值 (<span id="local_currAmt"><%= userData.currAmt %></span>)</span>
        </a>
    </div>
    <div class="weui-flex__item textCenter tb centerContent">
        <a data-u="giftInfo" class="btnArea" href="javascript:void(0);">
            <span style="font-size: 14px">礼券 (<span id="local_giftQty"><%= userData.giftQty %></span>)</span>
        </a>
    </div>
</div>
<div class="tableBody">
    <div class="underline" style="top:0;background-color:#909090 "></div>
    <div class="weui-flex">
        <div class="weui-flex__item textCenter tbList">
            <% if(body.linkFlag == '1'){ %>
                <% if(body.gId === body.gIdMap.HuaDongTGP ){ %>
                <a href="http://n.weimob.com/saas/payment/weixinpay/retail_orderlist?pid=100000230810&storeId=43215810" >
                    <img src="<%= global.config.path.publicPath + body.imgPath %>/order.png" alt="">
                    全部订单
                </a>
                <% } else {%>
                <a href="<%= body.linkPath %>/myOrder?openId=<%= userData.openid %>&gId=<%= body.gId %>&orgCode=<%= body.orgCode %>">
                    <img src="<%= global.config.path.publicPath + body.imgPath %>/order.png" alt="">
                    全部订单
                </a>
                <% } %>
            <% }else{ %>
                <a href="javascript:void(0)" onclick="alert('未开通此功能')">
                    <img src="<%= global.config.path.publicPath + body.imgPath %>/order.png" alt="">
                    全部订单
                </a>
            <% } %>
        </div>

        <div class="weui-flex__item textCenter tbList">
            <a href="javascript:void(0)" onclick="alert('未开通此功能')">
                <img src="<%= global.config.path.publicPath + body.imgPath %>/collection.png" alt="">
                我的收藏
            </a>
        </div>
    </div>
    <!--
    <div class="weui-flex">
        &lt;!&ndash;<div class="weui-flex__item textCenter tbList">&ndash;&gt;
            &lt;!&ndash;<a href="<%= global.config.path.contextPath %>/view/pointSearch?openId=<%= userData.openid %>&publicId=<%= body.publicId %>&orgCode=<%= body.orgCode %>&cardCode=<%= userData.cardCode %>">&ndash;&gt;
                &lt;!&ndash;<img src="<%= global.config.path.publicPath + body.imgPath %>/point.png" alt="">&ndash;&gt;
                &lt;!&ndash;积分查询&ndash;&gt;
            &lt;!&ndash;</a>&ndash;&gt;
        &lt;!&ndash;</div>&ndash;&gt;
        <div class="weui-flex__item textCenter tbList">
            <% if(body.linkFlag == '1'){ %>
            &lt;!&ndash;<a href="<%= body.linkPath %>/myAddress?openId=<%= userData.openid %>&gId=<%= body.gId %>&orgCode=<%= body.orgCode %>">&ndash;&gt;
                &lt;!&ndash;<img src="<%= global.config.path.publicPath + body.imgPath %>/address.png" alt="">&ndash;&gt;
                &lt;!&ndash;收货地址&ndash;&gt;
            &lt;!&ndash;</a>&ndash;&gt;
            <% }else{ %>
            &lt;!&ndash;<a href="javascript:void(0)" onclick="alert('未开通此功能')">&ndash;&gt;
                &lt;!&ndash;<img src="<%= global.config.path.publicPath + body.imgPath %>/address.png" alt="">&ndash;&gt;
                &lt;!&ndash;收货地址&ndash;&gt;
            &lt;!&ndash;</a>&ndash;&gt;
            <% } %>

        </div>
    </div>
-->
    <div class="weui-flex">
        <!-- <div class="weui-flex__item textCenter tbList">
            <a href="<%= global.config.path.contextPath %>/view/storeSearch?openId=<%= userData.openid %>&publicId=<%= body.publicId %>&orgCode=<%= body.orgCode %>&cardCode=<%= userData.cardCode %>">
                <img src="<%= global.config.path.publicPath + body.imgPath %>/money.png" alt="">
                储值查询
            </a>
        </div>-->
        <div class="weui-flex__item textCenter tbList">
            <a href="<%= global.config.path.contextPath %>/view/modifyInfo?openId=<%= userData.openid %>&orgCode=<%= body.orgCode %>&publicId=<%= body.publicId %>&cardCode=<%= userData.cardCode %>&gId=<%= body.gId %>&brand=<%= body.brand %>"">
            <img src="<%= global.config.path.publicPath + body.imgPath %>/updateInfo.png" alt="">
            修改资料
            </a>
        </div>
        <div class="weui-flex__item textCenter tbList">
            <a href="<%= global.config.path.contextPath %>/view/feeSearch?gId=<%= body.gId %>&openId=<%= userData.openid %>&publicId=<%= body.publicId %>&orgCode=<%= body.orgCode %>&cardCode=<%= userData.cardCode %>">
                <img src="<%= global.config.path.publicPath + body.imgPath %>/services.png" alt="">
                消费查询
            </a>
        </div>
    </div>
    <div class="weui-flex">
        <!--<div class="weui-flex__item textCenter tbList">-->
        <!--<a href="<%= global.config.path.contextPath %>/view/giftInfo?openId=<%= userData.openid %>&publicId=<%= body.publicId %>&orgCode=<%= body.orgCode %>&cardCode=<%= userData.cardCode %>">-->
        <!--<img src="<%= global.config.path.publicPath + body.imgPath %>/wechatStore.png" alt="">-->
        <!--礼券查询-->
        <!--</a>-->
        <!--</div>-->
        <!--  <div class="weui-flex__item textCenter tbList">
            <a href="<%= global.config.path.contextPath %>/view/feeSearch?openId=<%= userData.openid %>&publicId=<%= body.publicId %>&orgCode=<%= body.orgCode %>&cardCode=<%= userData.cardCode %>">
                <img src="<%= global.config.path.publicPath + body.imgPath %>/services.png" alt="">
                消费查询
            </a>
        </div>-->
    </div>

    <div class="cardCode" style="border-top:  1px dashed grey;margin-top: 5px">
        <div>
            <img src="" id="barCode" style="height: 100px;">
        </div>
        <div id="qrcode"></div>
    </div>

    <div class="copyright">技术支持-上海法法信息</div>

</div>
<div class="weui-tabbar" style="position: fixed;height:55px;bottom: 0%">
    <% if(body.linkFlag == '1'){ %>
        <% if(body.gId === body.gIdMap.HuaDongTGP ){ %>
        <a href="https://100000230810.retail.n.weimob.com/saas/retail/100000230810/43215810/shop/index" class="weui-tabbar__item">
        <% } else {%>
        <a href="<%= body.linkPath %>/index?openId=<%= userData.openid %>&gId=<%= body.gId %>&brand=<%= data.brand %>&orgCode=<%= data.orgCode %>&publicId=<%= data.publicId %>" class="weui-tabbar__item">
        <% } %>
            <div class="weui-tabbar__icon">
                <img src="<%= global.config.path.publicPath %>/custom/images/icon/icon_nav_button.png" alt="">
            </div>
            <p class="weui-tabbar__label">首页</p>
        </a>
    <% }else{ %>
        <a href="javascript:void(0)" class="weui-tabbar__item" onclick="alert('未开通此功能')">
            <div class="weui-tabbar__icon">
                <img src="<%= global.config.path.publicPath %>/custom/images/icon/icon_nav_button.png" alt="">

            </div>
            <p class="weui-tabbar__label">首页</p>
        </a>
    <% } %>
    <% if(body.linkFlag == '1'){ %>
        <% if(body.gId === body.gIdMap.HuaDongTGP ){ %>
        <a href="https://100000230810.retail.n.weimob.com/saas/retail/100000230810/43215810/goods/classify" class="weui-tabbar__item">
        <% } else { %>
        <a href="<%= body.linkPath %>/category?openId=<%= userData.openid %>&gId=<%= body.gId %>&brand=<%= data.brand %>&orgCode=<%= data.orgCode %>&publicId=<%= data.publicId %>" class="weui-tabbar__item">
        <% } %>
            <div class="weui-tabbar__icon">
                <img src="<%= global.config.path.publicPath %>/custom/images/icon/icon_nav_cell.png" alt="">
            </div>
            <p class="weui-tabbar__label">分类</p>
        </a>

        <% if(body.gId === body.gIdMap.HuaDongTGP ){ %>
        <a href="https://100000230810.retail.n.weimob.com/saas/retail/100000230810/43215810/shop/cart" class="weui-tabbar__item">
        <% } else {%>
        <a href="<%= body.linkPath %>/cart?openId=<%= userData.openid %>&gId=<%= body.gId %>&brand=<%= data.brand %>&orgCode=<%= data.orgCode %>&publicId=<%= data.publicId %>" class="weui-tabbar__item">
        <% } %>
            <div class="weui-tabbar__icon">
                <img src="<%= global.config.path.publicPath %>/custom/images/icon/icon_gwc_hei.png" alt="">
            </div>
            <p class="weui-tabbar__label">购物车</p>
        </a>
    <% }else{ %>
        <a href="javascript:void(0)" class="weui-tabbar__item" onclick="alert('未开通此功能')">
            <div class="weui-tabbar__icon">
                <img src="<%= global.config.path.publicPath %>/custom/images/icon/icon_nav_cell.png" alt="">
            </div>
            <p class="weui-tabbar__label">分类</p>
        </a>
        <a href="javascript:void(0)" class="weui-tabbar__item" onclick="alert('未开通此功能')">
            <div class="weui-tabbar__icon">
                <img src="<%= global.config.path.publicPath %>/custom/images/icon/icon_gwc_hei.png" alt="">
            </div>
            <p class="weui-tabbar__label">购物车</p>
        </a>
    <% } %>
    <a href="javascript:void(0);" class="weui-tabbar__item  weui-bar__item--on">
        <div class="weui-tabbar__icon">
            <img src="<%= global.config.path.publicPath %>/custom/images/icon/icon_hy.png" alt="">
        </div>
        <p class="weui-tabbar__label">我的</p>
    </a>
</div>

<% include common/footer.ejs %>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?d13328b5db725a57a4babbcacdd4c38d";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();

</script>
<script>
    Dolphin.ajax({
        url: '<%= global.config.path.contextPath %>/work/getUserData?openId=<%= userData.openid %>&publicId=<%= data.publicId %>',
        type: 'get',
        onSuccess: function (reData) {
            console.log(reData);
            var qrcode = new QRCode(document.getElementById("qrcode"), {
                colorDark: '#000000',
                colorLight: '#ffffff',
                correctLevel: QRCode.CorrectLevel.H
            }); //初始化
            JsBarcode("#barCode", reData.result.cardCode);
            qrcode.makeCode(reData.result.cardCode);
        }
    });

    var localCardCode = '<%= userData.cardCode %>';
    Dolphin.ajax({
        url: '<%= global.config.path.contextPath %>/work/flushRedisData?openId=<%= userData.openid %>&publicId=<%= data.publicId %>',
        type: 'get',
        onSuccess: function (reData) {
            console.log(reData);
            if(reData.notFound){
                location.href = '<%= global.config.path.contextPath %>/view/login?openId=<%= userData.openid %>&publicId=<%= data.publicId %>&brand=<%=data.brand %>&orgCode=<%=data.orgCode %>&gId=<%=data.gId %>&linkFlag=<%=data.linkFlag %>';
            } else {
                var nud = reData.result;
                if (nud.cardCode != localCardCode) {
                    var qrcode = new QRCode(document.getElementById("qrcode"), {
                        colorDark: '#000000',
                        colorLight: '#ffffff',
                        correctLevel: QRCode.CorrectLevel.H
                    }); //初始化

                    JsBarcode("#barCode", nud.cardCode);
                    qrcode.makeCode(nud.cardCode);
                }
                var lsp;
                for (var k in nud) {
                    lsp = $("#local_" + k);
                    if (lsp && nud[k]) {
                        lsp.html(nud[k]);
                    }
                }

                $(".btnArea").click(function () {
                    location.href = '<%= global.config.path.contextPath %>/view/' + $(this).data('u') + '?gId=<%= body.gId %>&openId=<%= userData.openid %>&publicId=<%= body.publicId %>&orgCode=<%= body.orgCode %>&cardCode=' + nud.cardCode;
                });
            }
        }
    });

</script>

</body>
</html>
